#ifndef FORMHISTROY_H
#define FORMHISTROY_H

#include <QWidget>
#include <QSqlQueryModel>
#include <QSqlRecord>
#include <QSqlQuery>
#include <QSortFilterProxyModel>
#include <QSqlTableModel>
#include <QDateTime>

#include "mydelegate.h"

namespace Ui {
class FormHistroy;
}

class FormHistroy : public QWidget {
    Q_OBJECT

public:
    explicit FormHistroy(QWidget *parent = nullptr);
    ~FormHistroy();

private slots:
    void on_btnClose_2_clicked();

    void on_AlarmPageFrist_clicked();

    void on_AlarmPagePrevious_clicked();

    void on_AlarmPageNext_clicked();

    void on_AlarmPageEnd_clicked();

    void on_cBoxAlarm_currentIndexChanged(int index);

    void on_AlarmRefresh_clicked();

    void on_pushButton_clicked();

private:
    Ui::FormHistroy *ui;
    QSqlQueryModel* model, *alarmmodel;
    QSqlTableModel * tablemodel;
    int alarmPage,
        alarmPages,
        alarmSize = 10,
        recs = 0;
    void initAlarmView();
    void showAlarm();
    void calcPageSize();

signals:
    void alarmPageChanged();
};

#endif // FORMHISTROY_H
